package com.example.springsecurityreactivedemo.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
public class HelloController {
    @PreAuthorize("hasRole('admin')")
    @GetMapping("/hello")
    Mono<String> hello() {
        return Mono.just("hello, hello");
    }

    @PreAuthorize("hasAuthority('haha')")
    @GetMapping("/world")
    Mono<String> world() {
        return Mono.just("hello, world");
    }
}
